<?php
namespace Admin\Controller;
use Think\Controller;
class LinksController extends Controller {
    public function index(){
        //实例化links表
          $links = D('links');
        //调用links类中方法
        $list = $links->links_sel();
        $this->assign('list',$list['list']);
        $this->display();
    }
    //删除links时调用
    public function del_links(){
        $links = D('links');
        $res = $links->links_del();
        echo $res;
    }
    //显示添加链接模板
    public function add_links(){
        $this->display();
    }
    //添加操作方法
    public function ad_links(){
        $links = D('links');
        //调用添加方法
         $res = $links->links_add();
         if($res){
                $this->success('添加成功','','100');
            }else{
                $this->error('添加失败','','100');
            }
    }
    //跳转修改页方法
    public function edit_links(){
        $links = D('links');
        $list = $links->links_find();
        $this->assign('list',$list);
        $this->display();
    }
    //执行修改方法
    public function update_links(){
        $links = D('links');
        $res = $links->links_update();
        if($res){
            $this->success('修改成功',U('Admin/Links/index'),1);
        }else{
            $this->error('修改失败','',1);
        }
    }
}